package com.lzy.mall.common.utils;

import com.lzy.mall.common.exception.CommonError;
import io.renren.common.exception.RRException;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author lzy
 * @date 2021/9/25 10:18
 */
public class CommonUtil {
    public static Boolean isPhone(String phone) {
        String regex = "^1[3-9]\\d{9}$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(phone);

        return matcher.find();
    }

    public static Boolean isIdNumber(String idNumber) {
        String regex = "\\d{17}[\\d|x]|\\d{15}";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(idNumber);
        return matcher.find();
    }
}
